package com.wetao.lib_common.utils;

public class MultiClickUtil {
    // 两次点击按钮之间的点击间隔不能少于1000毫秒
    private static int MIN_CLICK_DELAY_TIME = 1000;
    private static long lastClickTime;

    public static boolean isFastClick() {
        boolean flag = false;
        long curClickTime = System.currentTimeMillis();
        if ((curClickTime - lastClickTime) >= MIN_CLICK_DELAY_TIME) {
            flag = true;
        }
        lastClickTime = curClickTime;
        return flag;
    }

    public static void setDelayTime(int millis) {
        MIN_CLICK_DELAY_TIME = millis;
    }

    public static void clearLastClickTime() {
        lastClickTime = 0;
    }
}
